This application claims the benefit of a Japanese Patent Application No. 11-328758 filed Nov. 18, 1999, in the Japanese Patent Office, the disclosure of which is hereby incorporated by reference.
1. Field of the Invention
The present invention generally relates to program trace methods and apparatuses and storage media, and more particularly to a program trace method and apparatus for tracing a program which operates in a computer, and to a computer-readable storage medium which stores a program for causing a computer to make a program trace.
A program trace function refers to a function of tracing a program which operates in a computer. Tracing the program includes recording a history of processing blocks executed during operation of the program, such as the history of executed mathematical functions procedures and routines.
2. Description of the Related Art
Conventionally, in a program trace apparatus, a so-called break point instruction is embedded at an address which is specified as a trace point. In addition, the program trace apparatus employs a trace point management which manages information related to the specified trace point by a table.
However, according to the simple trace point management described above, there is a problem in that an extremely long search time is required. For example, in a case where an extremely large number of mathematical functions provided by an operating system or the like are to be traced in their entirety, the trace point is identified after intercepting the control at the trace point, which results in the extremely long search time.
On the other hand, it is conceivable to construct the program trace apparatus so as to overwrite a plurality of instructions and transfer additional information when intercepting the control. However, when overwriting a plurality of instructions, it will be necessary to judge whether or not a branch instruction will jump to an instruction which is being rewritten. Hence, it will be necessary to analyze the instructions throughout the entire program. In addition, if the branch instruction will jump to the instruction which is being rewritten, it will also be necessary to make a modification so as to adapt to the original branch instruction. Furthermore, in a multi-processor system, it will also be necessary to carry out an exclusive process during the rewriting of the instruction. For these reasons, there is a problem in that this conceivable program trace apparatus which overwrites a plurality of instructions and transfers the additional information when intercepting the control is difficult to realize.
Accordingly, it is a general object of the present invention to provide a novel and useful program trace method and apparatus and storage medium, in which the problems described above are eliminated.
Another and more specific object of the present invention is to provide a program trace method and apparatus and a storage medium, which can carry out a program trace at a high speed by searching trace points within a short time, even with respect to a extremely large number of trace points which are specified.
Still another object of the present invention is to provide a program trace apparatus which intercepts control during execution thereof by rewriting of an instruction sequence of a program and traces an execution state of the original program, comprising first judging means for judging whether or not an arbitrary instruction which is to be rewritten to intercept the control is longer than a control transfer instruction which is written over the arbitrary instruction to intercept the control, and first identification means for identifying a trace point by storing an index data for identifying a rewritten location in one or more surplus bytes of the arbitrary instruction if the first judging means judges that the arbitrary instruction is longer than the control transfer instruction and the one or more surplus bytes exist in the arbitrary instruction. According to the program trace apparatus of the present invention, it is possible to easily rewrite the instruction during execution of the program, and it is possible to carry out the program trace at a high speed by searching the trace point within a short time even in a case where an extremely larger number of parts of the instruction are rewritten at the same time in order to intercept the control.
A further object of the present invention is to provide a program trace apparatus which intercepts control during execution thereof by rewriting of an instruction sequence of a program and traces an execution state of the original program, comprising means for rewriting an arbitrary instruction which is to be rewritten by an index data which specifies a trace point and a control transfer instruction which is used to intercept the control, and means for identifying the trace point by use of the index data notified by an interrupt. According to the program trace apparatus of the present invention, it is possible to easily rewrite the instruction during execution of the program, and it is possible to carry out the program trace at a high speed by searching the trace point within a short time even in a case where an extremely larger number of parts of the instruction are rewritten at the same time in order to intercept the control.
Another object of the present invention is to provide a computer-readable storage medium which stores a program trace program for causing a computer to carry out a program trace which intercepts control during execution thereof by rewriting of an instruction sequence of a program and traces an execution state of the original program, the program trace program comprising a first procedure causing the computer to judge whether or not an arbitrary instruction which is to be rewritten to intercept the control is longer than a control transfer instruction which is written over the arbitrary instruction to intercept the control, and a first identification procedure causing the computer to identify a trace point by storing an index data for identifying a rewritten location in one or more surplus bytes of the arbitrary instruction if the first judging means judges that the arbitrary instruction is longer than the control transfer instruction and the one or more surplus bytes exist in the arbitrary instruction. According to the storage medium of the present invention, it is possible to easily rewrite the instruction during execution of the program, and it is possible to carry out the program trace at a high speed by searching the trace point within a short time even in a case where an extremely larger number of parts of the instruction are rewritten at the same time in order to intercept the control.
Still another object of the present invention is to provide a computer-readable storage medium which stores a program trace program for causing a computer to carry out a program trace which intercepts control during execution thereof by rewriting of an instruction sequence of a program and traces an execution state of the original program, the program trace program comprising a procedure causing the computer to rewrite an arbitrary instruction which is to be rewritten by an index data which specifies a trace point and a control transfer instruction which is used to intercept the control, and a procedure causing the computer to identify the trace point by use of the index data notified by an interrupt. According to the storage medium of the present invention, it is possible to easily rewrite the instruction during execution of the program, and it is possible to carry out the program trace at a high speed by searching the trace point within a short time even in a case where an extremely larger number of parts of the instruction are rewritten at the same time in order to intercept the control.
A further object of the present invention is to provide a program trace method which intercepts control during execution thereof by rewriting of an instruction sequence of a program and traces an execution state of the original program, comprising the steps of (a) judging whether or not an arbitrary instruction which is to be rewritten to intercept the control is longer than a control transfer instruction which is written over the arbitrary instruction to intercept the control, and (b) identifying a trace point by storing an index data for identifying a rewritten location in one or more surplus bytes of the arbitrary instruction if the step (a) judges that the arbitrary instruction is longer than the control transfer instruction and the one or more surplus bytes exist in the arbitrary instruction. According to the program trace method of the present invention, it is possible to easily rewrite the instruction during execution of the program, and it is possible to carry out the program trace at a high speed by searching the trace point within a short time even in a case where an extremely larger number of parts of the instruction are rewritten at the same time in order to intercept the control.
Another object of the present invention is to provide a program trace apparatus which intercepts control during execution thereof by rewriting of an instruction sequence of a program and traces an execution state of the original program, comprising the steps of (a) rewriting an arbitrary instruction which is to be rewritten by an index data which specifies a trace point and a control transfer instruction which is used to intercept the control, and (b) identifying the trace point by use of the index data notified by an interrupt. According to the program trace method of the present invention, it is possible to easily rewrite the instruction during execution of the program, and it is possible to carry out the program trace at a high speed by searching the trace point within a short time even in a case where an extremely larger number of parts of the instruction are rewritten at the same time in order to intercept the control.